#ifndef __GATE_H__
#define __GATE_H__

//#include <complex>
#include <iostream>
#include "qubit.h"
using namespace std;

#define type float
#define I 0
#define H 1

class gate{
public:
    complex<type> ** m;
    int ro, co;
    void allocate( int, int );
    void initialize( complex<type> ** );
    void delete_gate( void );
    ///// 
    class gate_exception{};
    gate(int = 2, int = 2, int = I);
    gate( const gate & );   //copy constructor
    gate( gate && );        //move constructor
    gate & operator=( const gate & );  //copy assignment
    gate & operator=( gate && );    //move assignment
    gate operator+( const gate & );
    complex<type> & operator()( int, int );
    int row( void )const;
    int col( void )const;
    friend ostream & operator<<( ostream &, const gate & );
    friend gate tensorProduct(gate &, gate &); // 张量积
    ~gate( void );    
};

#endif